package com.warm.pump.module.sys.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.warm.pump.module.sys.dao.gen.AreaDao;
import com.warm.pump.module.sys.bean.po.gen.Area;
import com.warm.pump.module.sys.service.IAreaService;
import com.warm.pump.frame.gen.bean.PageBean;



@Service("AreaService")
public class AreaServiceImpl implements IAreaService {
	@Autowired
	private AreaDao areaDao;

	@Override
	public Area queryObject(Integer  id){
		return areaDao.selectByPrimaryKey( id);
	}

	public Area queryObject(Map<String, Object> map){
		return areaDao.selectByMap( map);
	}
	
	@Override
	public List<Area> queryList(Map<String, Object> map){
		return areaDao.getListByMap(map);
	}

    @Override
    public PageBean getPageBeanByMap(Map map,int pageNo,int pageSize) {
		return areaDao.getPageBeanByMap(map, pageNo, pageSize);
    }


	@Override
	public int queryTotal(Map<String, Object> map){
		return areaDao.countTotalByMap(map);
	}
	
	@Override
	public void save(Area area){
		areaDao.insertSelective(area);
	}
	
	@Override
	public void update(Area area){
		areaDao.updateByPrimaryKeySelective(area);
	}
	
	@Override
	public void delete(Integer  id){
		areaDao.deleteByPrimaryKey(id);
	}

	@Override
	public void delete(Map<String, Object>  map){
	areaDao.deleteByMap(map);
	}
	
	@Override
	public void deleteBatch(Integer[]  ids){
		Map<String, Object> map = new HashMap<>();
		map.put("id_in",ids);
		areaDao.deleteByMap(map);
	}
	
}
